home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / language / clisp_c.zoo / impnotes.txt < prev    next >
Text File  |  1993-06-05  |  45KB  |  1,298 lines

  1.                 Implementation Notes for CLISP
  2.                 ==============================
  3.                 Last modified: 20 May 1993.
  4.  
  5. This implementation is mostly compatible to the standard reference
  6.  
  7.        Guy L. Steele Jr.: Common Lisp - The Language (1st ed.).
  8.        Digital Press 1984.
  9.        (CLtL1 for short)
  10.  
  11.  
  12. These notes document the differences of the CLISP implementation of Common
  13. Lisp to the standard CLtL1, and some implementation details.
  14.  
  15.  
  16.                       CHAPTER 1: Introduction
  17.                       -----------------------
  18.  
  19. No notes.
  20.  
  21.  
  22.                        CHAPTER 2: Data Types
  23.                        ---------------------
  24.  
  25. All the data types are implemented: numbers, characters, symbols, lists,
  26. arrays, hash tables, readtables, packages, pathnames, streams, random
  27. states, structures and functions.
  28.  
  29. 2.1.3.
  30. ------
  31.  
  32. There are four floating point types: short-float, single-float, double-float
  33. and long-float:
  34.                   sign    mantissa   exponent
  35.    short-float    1 bit   16+1 bits   8 bits
  36.    single-float   1 bit   23+1 bits   8 bits   CLISP uses IEEE format
  37.    double-float   1 bit   52+1 bits  11 bits   CLISP uses IEEE format
  38.    long-float     1 bit   >=64 bits  32 bits
  39.  
  40. The single and double float formats are those of the IEEE standard (1981),
  41. except that CLISP does not support features like +0, -0, +inf, -inf, gradual
  42. underflow, NaN, etc. (Common Lisp does not make use of these features.)
  43.  
  44. Long floats have variable mantissa length, which is a multiple of 16 (or 32,
  45. depending on the word size of the processor). The default length used when
  46. long floats are read is given by the place (LONG-FLOAT-DIGITS). It can be
  47. set by (SETF (LONG-FLOAT-DIGITS) nnn), where nnn is a positive integer.
  48.  
  49. 2.1.4.
  50. ------
  51.  
  52. Complex numbers can have a real part and an imaginary part of different
  53. types. For example, (SQRT -9.0) evaluates to the number #C(0 3.0), which has
  54. a real part of exactly 0, not only 0.0 (which would mean "approximately 0").
  55. The type specifier for this is (COMPLEX INTEGER SINGLE-FLOAT), and
  56.  
  57.            (COMPLEX type-of-real-part type-of-imaginary-part)
  58.  
  59. in general.
  60. The type specifier (COMPLEX type) is equivalent to (COMPLEX type type).
  61.  
  62. 2.2.1.
  63. ------
  64.  
  65. The characters are ordered according to the ASCII encoding.
  66.  
  67. More precisely, CLISP uses the Atari character set:
  68.              $0 $1 $2 $3 $4 $5 $6 $7 $8 $9 $A $B $C $D $E $F
  69.          $00 **             ** ** ** ** ** ** ** ** **      
  70.          $10                               ** **            
  71.          $20     !  "  #  $  %  &  '  (  )  *  +  ,  -  .  /
  72.          $30  0  1  2  3  4  5  6  7  8  9  :  ;  <  =  >  ?
  73.          $40  @  A  B  C  D  E  F  G  H  I  J  K  L  M  N  O
  74.          $50  P  Q  R  S  T  U  V  W  X  Y  Z  [  \  ]  ^  _
  75.          $60  `  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o
  76.          $70  p  q  r  s  t  u  v  w  x  y  z  {  |  }  ~  
  77.          $80  Ç  ü  é  â  ä  à  å  ç  ê  ë  è  ï  î  ì  Ä  Å
  78.          $90  É  æ  Æ  ô  ö  ò  û  ù  ÿ  Ö  Ü  ¢  £  ¥  ß   
  79.          $A0  á  í  ó  ú  ñ  Ñ  ª  º  ¿     ¬  ½  ¼  ¡  «  »
  80.          $B0  ã  õ  Ø  ø        À  Ã  Õ  ¨  ´  +  ¶  ©  ®   
  81.          $C0                                                
  82.          $D0                                         §      
  83.          $E0                    µ                           
  84.          $F0     ±              ÷     °              ²  ³  ¯
  85. Here ** are control characters, not graphic characters. (The characters left
  86. blank here cannot be represented in this character set).
  87.  
  88. The following are standard characters:
  89.   #\Space               $20
  90.   #\Newline             $0A
  91. The following are semi-standard characters:
  92.   #\Backspace           $08
  93.   #\Tab                 $09
  94.   #\Linefeed            $0A
  95.   #\Page                $0C
  96.   #\Return              $0D
  97.   #\Rubout              $08
  98.  
  99. 2.2.2.
  100. ------
  101.  
  102. #\Newline is the delimiter between lines.
  103.  
  104. When writing to a file, #\Newline is converted to CR/LF. (This is the usual
  105. convention on ATARI, DOS and VMS.) For example, #\Return #\Newline is written
  106. as CR/CR/LF.
  107. When reading from a file, CR/LF is converted to #\Newline, and CR not
  108. followed by LF is read as #\Return.
  109.  
  110. 2.2.3.
  111. ------
  112.  
  113. There are the following additional characters with names:
  114.   #\Null                $00
  115.   #\Bell                $07
  116.   #\Escape              $1B
  117.  
  118. 2.2.4.
  119. ------
  120.  
  121. The code of a character is >=0, <256. CHAR-CODE-LIMIT = 256.
  122.  
  123. There are fonts 0 to 15, and CHAR-FONT-LIMIT = 16. But the system itself
  124. uses only font 0.
  125.  
  126. The following bits attributes are implemented: :CONTROL, :META, :SUPER,
  127. :HYPER. Therefore CHAR-BITS-LIMIT = 16.
  128. The system itself uses these bits only to mention special keys and
  129. Control/Alternate/Shift key status on return from
  130. (READ-CHAR *KEYBOARD-INPUT*).
  131.  
  132. 2.5.
  133. ----
  134.  
  135. The maximum rank (number of dimensions) of an array is 65535 on 16-bit
  136. processors, 4294967295 on 32-bit processors.
  137.  
  138. 2.13.
  139. -----
  140.  
  141. All the functions built by FUNCTION, COMPILE and the like are atoms. There
  142. are built-in functions written in C, compiled functions (both of type
  143. COMPILED-FUNCTION) and interpreted functions (of type FUNCTION).
  144. The possible function names (CLtL1 p. 59) are symbols and lambda expressions.
  145.  
  146. 2.14.
  147. -----
  148.  
  149. This is the list of objects whose external representation can not be
  150. meaningfully read in:
  151.   * all structures lacking a keyword constructor.
  152.   * all arrays except strings, if *PRINT-ARRAY* = NIL.
  153.   * #<SYSTEM-FUNCTION name>     built-in function written in C
  154.   * #<SPECIAL-FORM name>        special form handler
  155.   * #<COMPILED-CLOSURE name>    compiled function, if *PRINT-CLOSURE* = NIL
  156.   * #<CLOSURE name ...>         interpreted function
  157.   * #<FRAME-POINTER #x...>      pointer to a stack frame
  158.   * #<DISABLED POINTER>         frame pointer which has become invalid on
  159.                                 exit from the corresponding BLOCK or TAGBODY
  160.   * #<...-STREAM ...>           stream
  161.   * #<PACKAGE name>             package
  162.   * #<HASH-TABLE #x...>         hash table, if *PRINT-ARRAY* = NIL
  163.   * #<READTABLE #x...>          readtable
  164.   * #<UNBOUND>                  "value" of a symbol without value, "value"
  165.                                 of an unsupplied optional or keyword argument
  166.   * #<SPECIAL REFERENCE>        environment marker for variables declared
  167.                                 SPECIAL
  168.   * #<DOT>                      internal READ result for "."
  169.   * #<END OF FILE>              internal READ result, when the end of file
  170.                                 is reached
  171.   * #<READ-LABEL ...>           intermediate READ result for #n#
  172.   * #<ADDRESS #x...>            machine address, should not occur
  173.   * #<SYSTEM-POINTER #x...>     should not occur
  174.  
  175. 2.15.
  176. -----
  177.  
  178. The type NUMBER is the disjoint union of the types REAL and COMPLEX. (CLtL
  179. wording: "exhaustive partition")
  180. The type REAL is the disjoint union of the types RATIONAL and FLOAT.
  181. The type RATIONAL is the disjoint union of the types INTEGER and RATIO.
  182. The type INTEGER is the disjoint union of the types FIXNUM and BIGNUM.
  183. The type FLOAT is the disjoint union of the types SHORT-FLOAT, SINGLE-FLOAT,
  184. DOUBLE-FLOAT and LONG-FLOAT.
  185.  
  186.  
  187.                      CHAPTER 3: Scope and Extent
  188.                      ---------------------------
  189.  
  190. is implemented as described.
  191.  
  192.  
  193.                       CHAPTER 4: Type Specifiers
  194.                       --------------------------
  195.  
  196. 4.5.
  197. ----
  198.  
  199. The general form of the COMPLEX type specifier is
  200. (COMPLEX type-of-real-part type-of-imaginary-part).
  201. The type specifier (COMPLEX type) is equivalent to (COMPLEX type type).
  202.  
  203. 4.6.
  204. ----
  205.  
  206. The REAL type specifier (REAL low high) denotes the real numbers between low
  207. and high.
  208.  
  209. 4.7.
  210. ----
  211.  
  212. DEFTYPE lambda lists are subject to destructuring (nested lambda lists are
  213. allowed, as in DEFMACRO) and may contain a &WHOLE marker, but no
  214. &ENVIRONMENT marker.
  215.  
  216. 4.9.
  217. ----
  218.  
  219. The possible results of TYPE-OF are:
  220.  CONS
  221.  SYMBOL NULL
  222.  FIXNUM BIGNUM RATIO SHORT-FLOAT SINGLE-FLOAT DOUBLE-FLOAT LONG-FLOAT COMPLEX
  223.  CHARACTER
  224.  (ARRAY element-type dimensions), (SIMPLE-ARRAY